package utils;

import algorithms.SortStrategy;

public class Timer {
    public static int[] time(SortStrategy strategy, int[] data, int avg) throws InterruptedException {
        long begin = System.nanoTime();
        int[] ret = new int[0];
        for (int time=0; time<avg; time++)
            ret = strategy.sort(data);
        long elapsedTime = System.nanoTime()-begin;
        System.out.println("Elapsed Time is " + new Double(elapsedTime)/1e6/avg + " (ms)");
        return ret;
    }
}
